<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
/*    var student={
      name:"",
      age:0,
      sname:function(name){
        this.name=name;
        console.log(this.name);
      }
    }
    student.sname.prototype.getName=function(){
      console.log("hello");
    }
    let student2=new student.sname("sss");
    student2.getName();*/

    //ES6后引入class关键字
    class Student{
      constructor(name){
        this.name = name;
      }
      hello(){
        alert("hello");
      }
    }
    class primaryStudent extends Student{
      constructor(name,garde){
        super(name);
        this.garde = garde;
      }
      myGarde(){
        alert("我是"+this.garde+"年级学生");
      }
    }
    xiaoming = new Student("xiaoming");
    xiaohong = new primaryStudent("xiaohong",2);
  </script>
</head>
<body>

</body>
</html>